package org.datascooter.test.jpaSimple;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Version;

@Entity
public class Customer {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	Long id;
	@Version
	public int version;
	@ManyToOne
	Address address;
	@Basic
	String description;
	@OneToMany(targetEntity = Order2.class, mappedBy = "customer")
	List<Order2> orders = new ArrayList<Order2>();
	@ManyToMany(mappedBy = "customers")
	Set<DeliveryService> serviceOptions = new HashSet<DeliveryService>();

	public Long getId() {
		return id;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address addr) {
		this.address = addr;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String desc) {
		this.description = desc;
	}

	public List<Order2> getOrders() {
		return orders;
	}

	public Set<DeliveryService> getServiceOptions() {
		return serviceOptions;
	}

	public void setId(Long l) {
		id = l;
	}

	public void setOrders(List<Order2> orders) {
		this.orders = orders;
	}

	public void setServiceOptions(Set<DeliveryService> serviceOptions) {
		this.serviceOptions = serviceOptions;
	}
}
